<template>
	<view class="page bg-white">
		<!-- 头部 start -->
		<view class="cu-custom bg-white   " :style="[{ height: CustomBar + 'px' }]">
			<view class="cu-bar bg-top fixed bg-white"
				:style="[{ height: CustomBar + 'px', paddingTop: StatusBar + 'px' }]">
				<view class="margin-left width-160 text-left" @tap="back"><text class="cuIcon-back"></text></view>
				<view class="">{{pageType=='goods'?'商品参数':'包装清单'}}</view>
				<view class="right margin-right text-right width-160">
				</view>
			</view>
		</view>
		<!-- 头部 end -->
		<!-- 筛选 -->
		<!-- loading组件 -->
		<fu-loading v-if="isShowLoading"></fu-loading>
		<block v-else>
			<!--商品列表 start-->
			<view class=" padding-lr relative  ">
				<view class=" w100">
					<view class="flex align-center  bg-white padding-bottom radius-16"
						v-for="(item, index) in cateLists" :key="index">
						<view class="flex   relative   ">
							<view class="flex  text-df width-180 flex-shrink margin-right-sm">
								<view class="text-666 ">{{item.title}}  </view>
							</view>
							<view class="">{{item.value}}  </view>
						</view>
					</view>
				</view>

			</view>
			<!-- 空布局 -->
			<fu-empty-ui v-if="cateLists.length == 0 "></fu-empty-ui>
		</block>
		<!-- 库存输入弹框 -->
		<fu-popup v-model="isShowCate" mode="center" border-radius="16" :mask-close-able="false">
			<view class="bg-white width-560">
				<view class="text-center padding text-lg text-333">{{pageType=='goods'?'添加商品参数':'添加包装清单'}}</view>
				<view class="padding-lr padding-bottom">
					<view class="  text-df text-333">标题</view>
					<view class="bg-f8 radius-8 padding-sm text-df margin-top">
						<input type="text" maxlength="10" placeholder="请输入标题名称" v-model="cateName"
							placeholder-class="text-df text-999">
					</view>
				</view>
				<view class="padding-lr padding-bottom">
					<view class="  text-df text-333">内容</view>
					<view class="bg-f8 radius-8 padding-sm text-df margin-top">
						<input type="text" maxlength="10" placeholder="请输入内容" v-model="cateName"
							placeholder-class="text-df text-999">
					</view>
				</view>
				<view class="foot solid-top flex align-center justify-between height-100">
					<view class="flex-sub text-gray solid-right text-center" @click="isShowCate=false">取消</view>
					<view class="flex-sub text-theme text-center" @click="handleConfirm">确定</view>
				</view>
			</view>
		</fu-popup>

		<!-- 断网检测组件 -->
		<fu-notwork></fu-notwork>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cateLists: [],
				isShowCate: false,
				cateName: '',
				isOpen: false,
				type: '', //弹框类型
				addType: '', //添加类型 child 子类
				editType: '', //添加类型 child 子类
				isShowLoading: false,
				pageType: '', //goods 商品参数  list 清单

			};
		},
		onLoad(e) {
			this.pageType = e.pageType
			this.cateLists=JSON.parse(e.data) 
		},
		onShow() {

		},
		onUnload() {

		},
		onHide() {
			let data = {}
			if (this.pageType == 'goods') {
				uni.$emit('goodsInfo', data)
			} else {
				uni.$emit('packInfo', data)
			}
		},
		methods: {
			back() {
				uni.navigateBack()
			},
			addPop(type) {
				this.isShowCate = true
			},
			openItem(item) {
				item.isOpen = false
			},
			closeItem(item) {
				item.isOpen = true
			},
			handleConfirm() {
				this.isShowCate = false
			},
		
			// 修改名称
			editItem(item, child, type) {
				this.type = 'edit'
				this.isShowCate = true

				if (type == 'child') {

				} else {

				}
			},
			getCate() {
				this.$api
					.post('', data)
					.then(res => {
						this.isShowLoading = false;
						if (res.data.code == 1) {
							this.cateLists = res.data.data
						} else {
							this.$message.error(res.data.msg);
						}
					})
					.catch(err => {
						this.isShowLoading = false;
					});
			},
		},

	}
</script>

<style>
	.hiddenBox {
		position: absolute;
		top: 62rpx;
		right: 0;
		width: 160rpx;
		z-index: 199;
	}

	.hiddenText {
		position: absolute;
		top: 62rpx;
		right: 0;
		width: 160rpx;
		z-index: 299;
	}

	page {
		height: 100vh;
		background: #fff;
	}
</style>
